package com.panopset.gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import com.panopset.Numbers;

/**
 * Customize this for your application, if necessary.
 *
 * @author Karl Dinwiddie
 *
 */
public final class LookAndFeel {

    /**
     * Arial.
     */
    public static final String ARIAL = "Arial";

    /**
     * Dialog.
     */
    public static final String DIALOG = "Dialog";

    /**
     * Monospace.
     */
    public static final String MONOSPACE = "Monospace";


    /**
     * Useful dimensions.
     */
    public enum Dimensions {

        /**
         * Typical window size is 800 x 600.
         */
        WINDOW(new Dimension(Numbers.Integers.DEFAULT_WIDTH.getValue(),
                Numbers.Integers.DEFAULT_HEIGHT.getValue()));

        /**
         * @param newValue
         *            New value.
         */
        private Dimensions(final Dimension newValue) {
            value = newValue;
        }

        /**
         * Value.
         */
        private Dimension value;

        /**
         * @return Value.
         */
        public Dimension getValue() {
            return value;
        }

        /**
         * @param newValue
         *            New value.
         */
        public void setValue(final Dimension newValue) {
            value = newValue;
        }
    }

    /**
     * Standard colors.
     */
    public enum Colors {

        /**
         * Line border color normal, was 0x55,0,0.
         */
        BORDER_COLOR_NORMAL(new Color(0x44, 0x44, 0x44)),

        /**
         * Foreground color.
         */
        FG_COLOR(new Color(0x44, 0x44, 0x44)),

        /**
         * Background color.
         */
        BG_COLOR(Color.WHITE),

        /**
         * Default is red.
         */
        BORDER_COLOR_ALERT(Color.RED),

        /**
         * Default is 0xff, 0x99, 0x00.
         */
        BORDER_COLOR_WAIT(new Color(0xff, 0x99, 0x00)),

        /**
         * Default is 0x00, 0x99, 0x00.
         */
        BORDER_COLOR_INPROGRESS(new Color(0x00, 0x99, 0x00)),

        /**
         * Default is black.
         */
        DSPMSG_BGD(Color.BLACK),

        /**
         * Default is red.
         */
        DSPMSG_RED_ALERT(Color.RED),

        /**
         * Default is yellow.
         */
        DSPMSG_YELLOW_ALERT(Color.YELLOW),

        /**
         * Default is green.
         */
        DSPMSG_GREEN_ALERT(Color.GREEN);

        /**
         * Color.
         */
        private Color color;

        /**
         * @param defaultColor
         *            Default color.
         */
        private Colors(final Color defaultColor) {
            color = defaultColor;
        }

        /**
         * @return Color.
         */
        public Color getColor() {
            return color;
        }

        /**
         * Set color.
         *
         * @param newColor
         *            New color.
         */
        public void setColor(final Color newColor) {
            color = newColor;
        }
    }

    /**
     * Standard fonts.
     */
    public enum Fonts {

        /**
         * Alert title font.  Default is Arial bold 10.
         */
        TITLE_FONT_ALERT(ARIAL, Font.BOLD, 10),

        /**
         * Label font.  Default is Arial bold 12.
         */
        LABEL_FONT(ARIAL, Font.BOLD, 12),

        /**
         * Control font. Default is Arial plain 12.
         */
        CONTROL_FONT(ARIAL, Font.PLAIN, 9),

        /**
         * Text area font. Default is Monospace plain 10.
         */
        TEXT_AREA_FONT(MONOSPACE, Font.PLAIN, 9),

        /**
         * Normal title font. Default is Arial plain 10.
         */
        TITLE_FONT_NORMAL(ARIAL, Font.PLAIN, 9);

        /**
         * @param name Name.
         * @param style Style.
         * @param size Size.
         */
        private Fonts(final String name, final int style, final int size) {
            font = new Font(name, style, size);
        }

        /**
         * Font.
         */
        private Font font;

        /**
         * @return Font.
         */
        public Font getFont() {
            return font;
        }

        /**
         * @param newFont
         *            New font.
         */
        public void setFont(final Font newFont) {
            font = newFont;
        }
    }

    /**
     * Based on SingletonHolder inner class by Bill Pugh.
     *
     * <h5>References</h5>
     * <ul>
     * <li>
     * <a href="http://en.wikipedia.org/wiki/Singleton_pattern">
     * http://en.wikipedia.org/wiki/Singleton_pattern </a></li>
     * </ul>
     *
     */
    private static final class Singleton {
        /**
         * Instance variable.
         */
        private static final LookAndFeel INSTANCE = new LookAndFeel();

        /**
         * Private constructor.
         */
        private Singleton() {
            // Prevent instantiation.
        }
    }

    /**
     * @return static FlagIcons instance.
     */
    protected static LookAndFeel getInstance() {
        return Singleton.INSTANCE;
    }

    /**
     * Private singleton constructor.
     */
    private LookAndFeel() {
    }
}
